#ifndef DATAHANDLER_H
#define DATAHANDLER_H

#include <QObject>
#include <QString>

// 1. 定义注入类
class DataHandler : public QObject
{
    Q_OBJECT
    // 2. 使用Q_PROPERTY注册Qml属性
    Q_PROPERTY(QString data MEMBER raw_data NOTIFY dataChanged)
public:
    DataHandler(QObject *parent = nullptr);
    ~DataHandler();
public:
    // 3. 使用Q_INVOKABLE注册方法
    Q_INVOKABLE QString getProcData();
signals:
    void dataChanged();
private:
    QString raw_data;
};

#endif // DATAHANDLER_H
